home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / bbs / recover / recover.bas < prev   
BASIC Source File  |  1994-08-12  |  5KB  |  203 lines

  1. REM Recover Program
  2. REM Written by N5VGC, Presley
  3. REM 
  4. REM This program was written when my system hung up and required a reload
  5. REM from a previous backup.  There were a series of priviate files with a
  6. REM status of PN that I did not want to loose.  In order to use the program,
  7. REM if you have such a problem, you must keep the DIRMES.SYS file and all
  8. REM the MAIL directories.  I backed all that up before I reloaded the system
  9. REM from a previous backup...
  10. REM This program will read the DIRMES.SYS file that has been saved and will
  11. REM create a header for each PN message file.  It will then read that message
  12. REM file and add it to the output file thus creating an import file in the 
  13. REM FBB import format.   When completed, you import that file and have 
  14. REM Recovered the message files...
  15. REM  
  16. REM  This program can be run with QBASIC that is shipped on all DOS systems.
  17. REM  You will need to set the file names and directories correctly.
  18. REM  Obviously, if you DIRMES.SYS is destroyed, this will NOT work.
  19. REM
  20. REM  The Author makes no claims as to how this will work, but it did the 
  21. REM  job for me.  I wanted to share it with others.  If you have questions
  22. REM  or problems with it, I can be reached at N5VGC @ N5VGC.#DFW.TX.USA.NA
  23. REM  of via internet at psmith@convex.com
  24. REM
  25. REM  Good luck with your recovery.    73 Presley  N5VGC
  26. REM
  27. REM
  28.  
  29. REM  This is the structure of the DIRMES.SYS record...
  30.  
  31. TYPE Header
  32. Typex   AS STRING * 1
  33. Statx   AS STRING * 1
  34. Long1   AS LONG
  35. Long2   AS LONG
  36. Long3   AS LONG
  37. Bbsf    AS STRING * 7
  38. Bbsv    AS STRING * 41
  39. Exped   AS STRING * 7
  40. Desti   AS STRING * 7
  41. Bid     AS STRING * 13
  42. Titre   AS STRING * 61
  43. Freex   AS STRING * 16
  44. Datesd  AS LONG
  45. Datech  AS LONG
  46. Fbbs    AS STRING * 10
  47. Forw    AS STRING * 10
  48. END TYPE
  49.  
  50. DIM Head AS Header
  51.  
  52. REM OPEN THE DIRMES.SYS FILE AND THE IMPORT FILE
  53.  
  54. OPEN "DIRMES.SYS" FOR RANDOM AS #3 LEN = 194
  55. OPEN "LIST.XXX" FOR OUTPUT AS #4 
  56.  
  57. j% = 0
  58.  
  59. rem  FOR i% = 1 to 1000
  60. i% = 1
  61.  
  62. DO UNTIL EOF (3)
  63.  
  64. GET #3, i%, Head
  65.  
  66. i% = i% + 1
  67.  
  68. x% = LEN (Head.Typex)
  69. y% = LEN (Head.Statx)
  70. z% = LEN (Head.Titre)
  71.  
  72. REM select only PN records and PH records... you many change this.
  73.  
  74. IF Head.Typex < > "P" GOTO nexit
  75. IF Head.Statx = "H" GOTO outit
  76. IF Head.Statx = "N" GOTO outit
  77. GOTO nexit
  78.  
  79. REM  Since C ends each string with hex 00, I must scan for that and set
  80. REM  the string length accordingly... that's what getstr () does...
  81.  
  82. outit:
  83.  
  84. form$ = "\\\\ ###### ###### \      \\       \\              \\                          \"
  85. PRINT "TYPE:      ", Head.Typex
  86. PRINT "STATUS:    ", Head.Statx
  87. PRINT "MES NUMBR: ", Head.Long1
  88. PRINT "MES SIZE:  ", Head.Long2
  89. PRINT "MES DATE:  ", Head.Long3
  90. PRINT "ADJ BBS:   ", Head.Bbsf
  91.  
  92. z% = 41
  93. CALL getstr (z%,l%,Head.Bbsv,atbbs$)
  94. IF l% = 0  THEN atbbs$ = "N5VGC"
  95. PRINT "ROUTE:     ", Head.Bbsv, atbbs$
  96.  
  97. z% = 7
  98. CALL getstr (z%,l%,Head.Exped,initbbs$)
  99. PRINT "DESTIN:    ", Head.Exped, initbbs$
  100.  
  101. z% = 7
  102. CALL getstr (z%,l%,Head.Desti,to$)
  103. PRINT "TO:        ", Head.Desti, to$
  104.  
  105. z% = 13
  106. CALL getstr (z%,l%,Head.Bid,bid$)
  107. PRINT "BID/MID:   ",Head.bid, bid$
  108.  
  109. z% = 61
  110. CALL getstr (z%,l%,Head.Titre,title$)
  111. PRINT "Title:     ", Head.Titre, title$
  112.  
  113. PRINT "Reserve:   ", Head.Freex
  114. PRINT "Date Frst: ", Head.Datesd
  115. PRINT "Date Stat: ", Head.Datech
  116. PRINT "FWD MSK:   ", Head.Fbbs
  117. PRINT "DONE MSK:  ", Head.Forw
  118.  
  119. REM  This just prints the record so I can verify it's okay...
  120.  
  121. PRINT using form$;  Head.Typex, Head.Statx, Head.Long1, Head.Long2, Head.Exped, Head.Desti,bid$,title$
  122.  
  123. REM  This sets up the SP line for the import file...
  124.  
  125. header$ = "SP " + to$ + " @ " + atbbs$ + " < " + initbbs$ + " $" + bid$
  126.  
  127. PRINT header$
  128. PRINT title$
  129.  
  130. num$ = str$(Head.Long1)
  131. num2$ = str$(Head.Long2)
  132.  
  133. REM  This determines the right file name in the MAIL directory to open...
  134.  
  135. IF LEN(num$) = 4 THEN numz$ = RIGHT$(num$, 3)
  136. IF LEN(num$) = 5 THEN numz$ = RIGHT$(num$, 4)
  137. IF LEN(num$) = 6 THEN numz$ = RIGHT$(num$, 5)
  138.  
  139. IF LEN(numz$) = 3 THEN numz1$ = "000" + numz$
  140. IF LEN(numz$) = 4 THEN numz1$ = "00" + numz$
  141. IF LEN(numz$) = 5 THEN numz1$ = "0" + numz$
  142.  
  143. dir$ = RIGHT$(numz1$, 1)
  144.  
  145. filenamex$ = "d:\fbb\mail\mail" + dir$ + "\m_" + numz1$ + ".mes"
  146.  
  147. PRINT filenamex$
  148.  
  149. REM  This opens the MAIL file...
  150.  
  151. OPEN filenamex$ FOR INPUT AS #6
  152.  
  153. REM This outpus the header file and the title of the message.
  154.  
  155. PRINT #4, header$
  156. PRINT #4, title$
  157.  
  158. REM  This reads the detail MAIL file and outputs to the import file...
  159.  
  160. DO UNTIL EOF (6)
  161. LINE INPUT #6, file6$
  162. PRINT #4, file6$
  163. PRINT file6$
  164.  
  165. LOOP
  166.  
  167. REM  This outputs the /ex 
  168.  
  169. CLOSE #6
  170. PRINT "/EX"
  171. PRINT #4, "/EX"
  172.  
  173. nexit:
  174. CLS
  175. LOOP
  176.  
  177. REM  DONE !!!! 
  178.  
  179. CLOSE #3
  180. CLOSE #4
  181.  
  182. END
  183.  
  184. REM Get real length of the string from the C record...
  185. REM z% length of input string
  186. REM l% length of output string  0 = null string
  187. REM in$ input string
  188. REM out$ output string
  189.  
  190. SUB getstr (z%,l%,in$,out$)
  191. for k% = 1 to z%
  192.  
  193. char$ = MID$(in$,k%,1)
  194. num% = ASC(char$)
  195. rem Print num%
  196. if num% = 0 goto stopscan2
  197. next
  198.  
  199. stopscan2:
  200. out$ = MID$(in$,1,k%-1)
  201. l% = LEN (out$)
  202. END SUB
  203.